********************************************************************************
* Author: Patrick Sullivan
* Title	: Teaching Tax Brackets - Analyses
* Date	: July 2025
********************************************************************************

**********************
*** General Notes: ***
**********************
* The Tables and Figures produced in this file generally follow the main text of
* the paper, with some code for some Appendix Tables/Figures already provided on
* earlier lines (see file titled '0_Attrition.do' for additional info on Attrition)

* The files are generally exported as .rtf, .docx, or .jpeg files, or will open directly.

* Additional changes to formatting, notes, a few variable names, and titles was 
* in some instances done manually.

***************
*** Outline ***
***************
* 1) Summary Statistics
* 2) Misperceptions
* 3) Association Between Misperceptions and Responses
* 4) First Stage/Manipulation Check (Video --> BracketJumpDecreaseIncome)
* 5) Video Treatment Effects on BehavioralResponses
* 6) Heterogeneities
* 7) Covariate Balance, Robustness Checks, Attention Checks

********************************************************************************
*** (!) NOTE (!) * RUN THE LINES BELOW BEFORE RUNNING ANY ADDITIONAL CODE !  ***
********************************************************************************

* coefplot 
ssc install coefplot, replace

* catcibar
net install catcibar, from("https://aarondwolf.github.io/catcibar") replace

* Additional
ssc install estout, replace
net sj 22-4
net install gr0092
net get gr0092

* Main Set Controls and Covariates used for TaxMisunderstanding / Knowledge Predictors
global predmain i.partyaff_agg i.econideol_agg collegedeg i.income_agg ///
				i.emp married i.agegroup_agg kids selfeconknow_high persfiled ///
				taxassist itemizer govbenefits eitc ctc govtrust_mostly ///
				govspending male i.race_agg


********************************************************************************
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////// 1) Summary Statistics ///////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
********************************************************************************


******************************
***** TABLE A4: Duration ***** 
******************************
sum Durationinminutes, detail
tabstat Durationinminutes, by(vidtreat) stat(N mean min p50 max)


***********************************************
***** TABLE 1: Respondent Characteristics *****
***********************************************

* Sample Charachteristics 
collect clear
foreach var in agegroup gender educ_agg income_agg race_agg married {
		table `var', statistic(frequency) statistic(percent) ///
		nototals name(basedemo_CR) append
}
collect layout ///
	(agegroup gender educ_agg income_agg race_agg married) ///
	(result[frequency percent])
collect notes "Notes. This table displays statistics for the survey and compares them to the characteristics of the U.S. adult population. Statistics are from the IPUMS-ASEC dataset from March 2022 (Flood et al. 2022)."
collect style html
collect export "RespondentCharachteristics.docx", replace
collect preview

* NOTE: To obtain descriptive statistics for the U.S. population, see:
	* Flood, Sarah, Miriam King, Renae Rodgers, Steven Ruggles, J. Robert Warren, and Michael
	*		Westberry. 2022. "Integrated Public Use Microdata Series, Current Population Survey:
	*		Version 10.0." Minneapolis, MN: IPUMS. https://doi.org/10.18128/D030.V10.0.

	
********************************************************************************
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////// 2) Graduated Tax Rate Misperceptions and Knowledge /////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
********************************************************************************


*******************************************************************************
***** TABLE A7: Tax Rate Misperceptions by Group (BASELINE MISPERCEPTION) *****
*******************************************************************************

collect clear
foreach var in partyaff_agg econideol_agg collegedeg income_agg emp married ///
				agegroup_agg kids selfeconknow_high persfiled taxassist itemizer ///
				govbenefits eitc ctc govtrust_mostly govspending male race_agg ///
{
		table `var', statistic(mean taxratemisp) statistic(frequency) name(taxratemisp) ///
		nformat(%9.2f) nototals append
}
collect layout (partyaff_agg econideol_agg collegedeg income_agg emp married ///
				agegroup_agg kids selfeconknow_high persfiled taxassist itemizer ///
				govbenefits eitc ctc govtrust_mostly govspending male race_agg) ///
				(result[])

collect style html
collect preview
collect style putdocx
collect export "Descriptive-GradTaxMisp.docx", replace


*************************************************************************************
***** TABLE A7: Tax Rate Misperceptions by Group (AGREE: BRACKET MISPERCEPTION) *****
*************************************************************************************

collect clear
foreach var in 	partyaff_agg econideol_agg collegedeg income_agg emp married ///
				agegroup_agg kids selfeconknow_high persfiled taxassist itemizer ///
				govbenefits eitc ctc govtrust_mostly govspending male race_agg ///
{
		table `var' if vidtreat==0, statistic(mean lowprehighpost_agree) statistic(frequency) ///
		name(lowprehighpost_agree) nformat(%9.2f) nototals append
}
collect layout (partyaff_agg econideol_agg collegedeg income_agg emp married ///
				agegroup_agg kids selfeconknow_high persfiled taxassist itemizer ///
				govbenefits eitc ctc govtrust_mostly govspending male race_agg) ///
				(result[])

collect style html
collect preview
collect style putdocx
collect export "Descriptive-BracketJump,DecreaseIncome.docx", replace


**********************************************************
***** Table A8: Predictors of Tax Rate Understanding *****
**********************************************************

estimates clear

***** Tax Rate Misperception: Answer To Tax Rate Scenario Question *****
reg taxratemisp $predmain , robust
quietly estadd local controls "Yes", replace
est store tp_1

***** BracketJump,DecreaseIncome (Placebo Group) *****
foreach var in lowprehighpost {	
	
	reg `var' $predmain if vidtreat==0, robust
	quietly estadd local controls "Yes", replace
	est store tp`var'
}

est dir

esttab tp* ///
using "Predictors-Misperceptions.rtf", ///
label se star(* .1 ** .05 *** .01) wide compress depvar nobaselevels nogaps replace ///
refcat (2.partyaff_agg "Party Affiliation (ref: Democrat)" 2.econideol_agg "Ideology (ref: Liberal)" ///
2.income_agg "Household Income (ref: $0-19.9k)" 2.emp "Employment status (ref: Full-time)" ///
2.agegroup_agg "Age (ref: under 30)" 2.race_agg "Race/Ethnicity (ref: White)", nolabel) ///
order(2.partyaff_agg 3.partyaff_agg 2.econideol_agg 3.econideol_agg) ///
stats(N, label("Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "Predictors-Misperceptions.rtf"


****************************************************************************
***** Figure 4:  Respondent Beliefs about Entering Higher Tax Brackets *****
****************************************************************************

* Tax Scenario Question - Answers to "Which scenario is after-tax income higher"
graph bar (percent), ///
	over(taxscen) asyvars blabel(bar, format(%4.2f) size(medium)) ///
	title("", size(medium)) ///
	bar(1, fcolor(red%50) lcolor(red)) bar(2, fcolor(green%50) lcolor(green)) ///
	legend(label(1 "Top of 12%") label(2 "Bottom of 22%") pos(3) col(1) size(medlarge)) ///
	ylabel(0 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%" 60 "60%", labsize(medium)) ///
	graphregion(color(white)) 
	
graph export "TaxRateMisp.jpg", as(jpg) replace


***************************************************************************
***** Figure A1: (mis)Perceptions About Entering Higher Tax Brackets *****
***************************************************************************

* Tax Bracket Knowl. (Placebo Group Responses)
hist tbknow if vidtreat==0, ///
	discrete percent ///
	addlabel addlabopts(mlabsize(mediumsmall)) ///
	xlabel( ///
		0 "AnyMisperception=1" ///
		1 "AnyMisperception=0" , ///
		labsize(medium)) gap(30) xscale(range(0 2)) ///
	xlabel(, nogrid) ///
	xtitle("") ///
	ytitle("Percent (%)" , size(medium)) yscale(titlegap(relativesize)) ///
	graphregion(color(white))

graph export "BracketMisUnderstanding.jpg", as(jpg) replace


********************************************************************************
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////// 3) Behavioral Responses: ASSOCIATION USING KNOWL. //////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
********************************************************************************


**********************************************************************************************
***** Table 3: (mis)Perceptions and Behavioral Responses:12-22 Percent Bracket Threshold *****
**********************************************************************************************

estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* TaxMisp
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' taxratemisp $predmain if vidtreat==0, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0 & taxratemisp==0 
	estadd scalar n1 = r(mean)
}

* BracketJump, Decrease Income (Placebo)
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' lowprehighpost $predmain if vidtreat==0, robust
    estimates store `depvar'b

	quietly estadd local controls "Yes", replace
}

* TaxBracketKnowledge (Placebo)
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' tbknowlimitednone $predmain if vidtreat==0, robust
    estimates store `depvar'c
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0 & tbknowlimitednone==0
	estadd scalar n2 = r(mean)
}
}

esttab *a using "YouRespond_UsingKnowl.rtf", replace ///
    title("Panel A - Baseline Misperception") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(taxratemisp) ///
	stats(controls n1 N, ///
	label("Controls" "Mean if Baseline Misperception=0" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

esttab *b using "YouRespond_UsingKnowl.rtf", append ///
    title("Panel B - Bracket Misperception") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(lowprehighpost) ///
	stats(controls N, ///
	label("Controls" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)
	
esttab *c using "YouRespond_UsingKnowl.rtf", append ///
    title("Panel C - Any Misperception") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(tbknowlimitednone) ///
	stats(controls n2 N, ///
	label("Controls" "Mean if AnyMisperception=0" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

* Open the exported RTF file to check
shell open "YouRespond_UsingKnowl.rtf"


********************************************************************************
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////// 4) First Stage: BracketJumpDecreaseIncome ///////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
********************************************************************************


*************************************************************************************
***** Figure 5: Agreement that Entering Higher Brackets can Decrease Net Income *****
*************************************************************************************

twoway (histogram lowprehighpost if vidtreat==0, discrete color(red%50)) ///        
       (histogram lowprehighpost if vidtreat==1, discrete color(green%50)), ///   
       legend(order(1 "Control" 2 "Treatment" )) ///
	   title("") ///
	   xlabel(1 `" "Strongly" "Disagree" "' 2 `" "Somewhat" "Disagree" "' 3 `" "Neither Agree" "Nor Disagree" "' ///
	   4 `" "Somewhat" "Agree" "' 5 `" "Strongly" "Agree" "', labsize(small)) ///   
	   xtitle("") ///
	   ylabel(0 .1 "10%" .2 "20%" .3 "30%" .4 "40%", labsize(medium)) ///
	   graphregion(color(white))
graph export "$figuredir/4_firststage_lphp.jpg", replace


*************************************************************************************************************
***** Table 4: Effect of Informational Video on Agreement that Jumping Brackets can Decrease Net Income *****
*************************************************************************************************************

estimates clear

foreach var in lowprehighpost lowprehighpost_agree {
	
	reg `var' vidtreat taxratemisp $predmain , robust
	eststo fsa`var'1
	quietly estadd local controls "Yes", replace
	sum `var' if vidtreat==0
	estadd scalar n1 = r(mean)

	
	reg `var' vidtreat taxratemisp i1.vidtreat#i1.taxratemisp $predmain , robust
	eststo fsa`var'2
	quietly estadd local controls "Yes", replace
	sum `var' if vidtreat==0
	estadd scalar n1 = r(mean)

}

est dir

* MODEL OUTPUT *
esttab fsa* using "Treat-BracketJumpDecrease.rtf", ///
se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps replace ///
keep(vidtreat taxratemisp 1.vidtreat#1.taxratemisp) scalars(n1) interaction(" x ") ///
stats(controls n1 N, label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "Treat-BracketJumpDecrease.rtf"

 
********************************************************************************
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////// 5) BEHAVIORAL RESPONSES ///////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
********************************************************************************


*****************************************************************************************************
***** Figure 6: Stated Propensity to Engage in Responses at the 12-22 Percent Bracket Threshold *****
*****************************************************************************************************

catcibar you_wl_mod you_le_mod you_av_mod you_ev_mod, over(vidtreat) ///
yscale(r(0 0.5)) ylabel( 0 "0" .1 "10%" .2  "20%" .3 "30%" .4 "40%" .5 "50%") ///
xlabel( , nogrid) ///
colors(red%50 green%50) ///
legend( position(6) row(1)) 


************************************************************************************************************************************
***** Table 5: Impact of Informational Video on Stated Propensity to Engage in Responses at the 12-22 Percent Bracket Threshold *****
************************************************************************************************************************************

estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    
	local depvar : word `i' of `depvars'
    regress `depvar' vidtreat, robust
    estimates store `depvar'ba
	
	quietly estadd local controls "No", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
	
	local depvar : word `i' of `depvars'
    regress `depvar' vidtreat taxratemisp $predmain , robust
    estimates store `depvar'ca
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "YouRespond_Treat.rtf", replace ///
    title("Panel A - Treatment Effects") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(vidtreat) ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

	
* Open the exported RTF file to check
shell open "YouRespond_Treat.rtf"


********************************************************************************
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///////////////////////////// 6) Heterogeneities ///////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
********************************************************************************


*********************************************************************
***** Table 6: Heterogeneous Treatment Effects by Prior Beliefs *****
*********************************************************************

estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' i.vidtreat##i.taxratemisp $predmain, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "Heterogeneities_GradTaxMisp.rtf", replace ///
    title("Panel A - Tax Misp.") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(1.vidtreat 1.taxratemisp 1.vidtreat#1.taxratemisp) interaction(" x ") ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "Heterogeneities_GradTaxMisp.rtf"


*******************************************************
***** Table A10 – Heterogeneous Treatment Effects *****
*******************************************************

* NOTE: Each chunk of code below corresponds to a respective panel in Table 10A *

*****************
*** Education ***
*****************
estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' i.vidtreat##i.college $predmain, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "Heterogeneities_EDUC.rtf", replace ///
    title("Panel A - College Degree") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(1.vidtreat 1.collegedeg 1.vidtreat#1.collegedeg) interaction(" x ") ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)
	
shell open "Heterogeneities_EDUC.rtf"

	
**************
*** Income ***
**************
estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' i.vidtreat##i5.income_agg i.partyaff_agg i.econideol_agg collegedeg ///
				i.emp married i.agegroup_agg kids selfeconknow_high persfiled ///
				taxassist itemizer govbenefits eitc ctc govtrust_mostly ///
				govspending male i.race_agg, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "Heterogeneities_INCOME.rtf", replace ///
    title("Panel B - Income $110k +") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(1.vidtreat 5.income_agg 1.vidtreat#5.income_agg) interaction(" x ") ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)
	
shell open "Heterogeneities_INCOME.rtf"


**************
*** Gender ***
**************
estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' i.vidtreat##i.male $predmain, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "Heterogeneities_GENDER.rtf", replace ///
    title("Panel C - Gender") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(1.vidtreat 1.male 1.vidtreat#1.male) interaction(" x ") ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "Heterogeneities_GENDER.rtf"

	
****************
*** PartyAff ***
****************
estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' i.vidtreat##i.partyaff_agg $predmain, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "Heterogeneities_PARTY.rtf", replace ///
    title("Panel D - Political Affiliation") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(1.vidtreat 2.partyaff_agg 3.partyaff_agg 1.vidtreat#2.partyaff_agg 1.vidtreat#3.partyaff_agg) interaction(" x ") ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "Heterogeneities_PARTY.rtf"	


****************
*** EconKnow ***
****************
estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' i.vidtreat##i.selfeconknow_high $predmain, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "Heterogeneities_EconKnow.rtf", replace ///
    title("Panel E - Self-Described Econ Know.") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(1.vidtreat 1.selfeconknow_high 1.vidtreat#1.selfeconknow_high) interaction(" x ") ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "Heterogeneities_EconKnow.rtf"


*******************
*** GovBenefits ***
*******************
estimates clear

{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' i.vidtreat##i.govbenefits $predmain, robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}

esttab *a using "Heterogeneities_GOVBEN.rtf", replace ///
    title("Panel F - Government Benefits") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(1.vidtreat 1.govbenefits 1.vidtreat#1.govbenefits) interaction(" x ") ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "Heterogeneities_GOVBEN.rtf"	


********************************************************************************
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///// 7) ADD. MODELS: Balance Tests, Alt. Specifications, Robustness Checks ////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
********************************************************************************


****************************************************************
***** Table A3: Predictors of Entering the Treatment Group *****
****************************************************************

estimates clear

foreach var in vidtreat {
	reg `var' taxratemisp i.partyaff_agg i.econideol_agg collegedeg ///
	i.income_agg i.emp married i.agegroup_agg kids selfeconknow_high ///
	persfiled taxassist itemizer govbenefits eitc ctc govtrust_mostly ///
	govspending male i.race_agg, robust
	
	est store b_`var'
	esttab b_`var', se wide label compress noconstant
	
}

***** MODEL OUTPUT *****
esttab b_* ///
using "CovariateBalance.rtf", ///
se star(* .1 ** .05 *** .01) wide label compress depvar nobaselevels nogaps replace ///
refcat (2.partyaff_agg "Pary Affiliation (ref: Democrat)" 2.econideol_agg "Ideology (ref: Liberal)" ///
2.income_agg "Household Income Quinitle (ref: 1st)" 2.emp "Employment status (ref: Full-time)" ///
2.agegroup_agg "Age (ref: under 30)" 2.race_agg "Ethnicity (ref: White)", nolabel) ///
stats(N, label("Observations") fmt(a2)) b(%9.2f) se(%9.2f)

shell open "CovariateBalance.rtf"


*****************************************
****** Table A9: Robustness Checks ******
*****************************************

*********************
*** Drop Speeders ***
*********************

preserve
drop if vidspeeder==1
estimates clear
{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' vidtreat taxratemisp $predmain , robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}
esttab *a using "YouRespond_Treat_NoSpeeder.rtf", replace ///
    title("Panel A - Dropping Speeders") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(vidtreat) ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)
restore

shell open "YouRespond_Treat_NoSpeeder.rtf"


**********************************
*** Drop Attention Check Fails ***
**********************************

preserve
drop if att_passed!=1
estimates clear
{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' vidtreat taxratemisp $predmain , robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}
esttab *a using "YouRespond_Treat_NoAttFail.rtf", replace ///
    title("Panel B - Dropping Attention Check Fails") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(vidtreat) ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)
restore

shell open "YouRespond_Treat_NoAttFail.rtf"

*********************************************
*** Drop Speeders + Attention Check Fails ***
*********************************************

preserve
drop if vidspeeder==1 | att_passed!=1
estimates clear
{
** Set the list of dependent variables
local depvars you_wl_mod you_le_mod you_av_mod you_ev_mod

** Set the number of dependent variables
local nvars : word count `depvars'

** Run the loop to estimate regressions and store results

* Treatment
forval i = 1/`nvars' {
    local depvar : word `i' of `depvars'
    regress `depvar' vidtreat taxratemisp $predmain , robust
    estimates store `depvar'a
	
	quietly estadd local controls "Yes", replace
	sum `depvar' if vidtreat==0
	estadd scalar n1 = r(mean)
}

}
esttab *a using "YouRespond_Treat_NoSpeedNoAttFail.rtf", replace ///
    title("Panel C - Dropping Speeders + AC Fails") ///
	se star(* .1 ** .05 *** .01) label compress depvar nobaselevels nogaps ///
	keep(vidtreat) ///
	stats(controls n1 N, ///
	label("Controls" "Placebo Mean" "Observations") fmt(a2)) b(%9.2f) se(%9.2f)
restore

shell open "YouRespond_Treat_NoSpeedNoAttFail.rtf"


**************************************
***** Table A6: Attention Checks *****
**************************************

* Att Check 1
tab att1_pass

* Att Check 2
tab att2_pass

* Both Attention Checks
tab att_passed
